package ɱɱɱ;

import java.util.*;

public class B_09_OldKeyboard {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String a = sc.nextLine();
		String b = sc.nextLine();
		boolean []broken = new boolean[500];	

		for(int i=0 ;i<500 ;i++){
			broken[i] = false;
		}

		for(int i=0 ;i<a.length() ;i++){	
			broken[a.charAt(i)] = true;
			if(a.charAt(i)>='A'&&a.charAt(i)<='Z'){
				broken[a.charAt(i)+32] = true;
			}
		}

		for(int i=0 ;i<b.length() ;i++){
			if(broken['+']){
				if(!broken[b.charAt(i)]&&(b.charAt(i)<'A'||b.charAt(i)>'Z')){
					System.out.print(b.charAt(i));
				}
			}else{
				if(!broken[b.charAt(i)]){
					System.out.print(b.charAt(i));
				}
			}
		}
		System.out.println();
	}
}

